#ifndef VIOSCONN_H
#define VIOSCONN_H

#define VIOS_PROTO_CONN_MAGIC 0x4e4e4f43  // CONN
#define VIOS_PROTO_DATA_MAGIC 0x41544144  // DATA

#define VIOS_CONN_OPCODE_NONE 0x0
#define VIOS_CONN_OPCODE_GET_PEER_STATE 0x1
#define VIOS_CONN_OPCODE_REPORT_STATE 0x2

#define VIOS_CONN_STATE_BROKEN 0x0
#define VIOS_CONN_STATE_UNKNOWN 0x1
#define VIOS_CONN_STATE_CONNECTING 0x2
#define VIOS_CONN_STATE_CONNECTED 0x3
#define VIOS_CONN_STATE_STOPPED 0x4

#define VIOS_CONN_TIMEOUT 1000

struct ViosProtoHeader {
    uint32_t magic;
    uint32_t len;
    uint32_t reserved[6];
};

// Should be aligned to struct ViosProtoHeader size
struct ViosConnHeader {
    uint32_t magic;
    uint32_t len;
    uint32_t opcode;
    uint32_t state;
    uint32_t pad[4];
};

// Should be aligned to struct ViosProtoHeader size
struct ViosDataHeader {
    uint32_t magic;
    uint32_t len;
    uint32_t opcode;
    uint32_t pad[5];
};

#endif // VIOSCONN_H
